const filters={
  //格式化日期为“yyyy-MM-dd hh:mm:ss”
  formatDate:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    var date = time.getDate();
    var hours = time.getHours();
    var minutes = time.getMinutes();
    var seconds = time.getSeconds();
    return year + '-' + rightTwo(month) + '-' + rightTwo(date) + ' ' + rightTwo(hours) + ':' + rightTwo(minutes) + ':' + rightTwo(seconds);
  },

  //格式化日期为“yyyy-MM-dd”
  formatDates:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    var date = time.getDate();
    return year + '-' + rightTwo(month) + '-' + rightTwo(date);
  },
  //格式化日期为“yyyy-MM”
  formatDatess:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    return year + '-' + rightTwo(month);
  },
//格式化日期为“yyyy-MM-dd hh:mm”
  formatDateo:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    var date = time.getDate();
    var hours = time.getHours();
    var minutes = time.getMinutes();
    return year + '-' + rightTwo(month) + '-' + rightTwo(date) + ' ' + rightTwo(hours) + ':' + rightTwo(minutes);
  },
  //格式化日期为“yy-MM-dd hh:mm”
  formatDateo1:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    var date = time.getDate();
    var hours = time.getHours();
    var minutes = time.getMinutes();
    return year + '-' + rightTwo(month) + '-' + rightTwo(date) + ' ' + rightTwo(hours) + ':' + rightTwo(minutes);
  },
  //格式化日期为“yyyyMM”
  formatDatesss:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    return year + rightTwo(month);
  },
  commonRadio(value){
      switch (value){
        case '1': return "是" 
        case '0': return "否" 
        default: return "--"
      }
  },
  customType(value){
      switch (value){
        case '1': return "供应商" 
        case '2': return "买方"
        case '3': return "供应商和买方"
        case '4': return "代理方"
        case '0': return "待确认"
        default: return "--"
      }
  },
  prjStatus(value){
      switch (value){  
        case '1': return "未签约" 
        case '2': return "已签约"
        case '3': return "签订中" 
        default: return "--"
      }
  },
  tradeTerms(value){
      switch (value){  
        case '1': return "CIF" 
        case '2': return "FOB"
        case '3': return "CNF" 
        default: return "--"
      }
  },
  moneyUnit(value){
    switch (value){   
        case '1': return "USD" 
        case '2': return "GBP"
        case '3': return "EUR" 
        case '4': return "HKD" 
        case '5': return "CNY" 
        default: return " " 
    }
  },
  taxRefundStatus(value){  
    switch (value){   
        case '0': return "未录入" 
        case '1': return "未申请"
        case '2': return "已申请,等待中" 
        case '3': return "已完成"  
        default: return "--" 
    }
  },
  transactionType(value){
    switch (value){   
        case '1': return "供应商——贸易商" 
        case '2': return "贸易商——贸易商"
        case '3': return "贸易商——买家"  
        default: return "--" 
    }
  },
  audit_status(value){ 
      switch(value){
          case '0':return '待审核'
          case '1':return '审核中'
          case '2':return '审核通过'
          case '3':return '审核未通过'
      }
  },
  useable_status(value){
      switch(value){
          case '0':return '不可用'
          case '1':return '正常' 
      }
  }

}
export default filters;